/*!
 * This file is part of the Sonata Project package.
 *
 * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

.form-horizontal .control-group {
  margin-bottom: 10px;
}

div {
  &.border {
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 7.5%);
  }

  &.connection {
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 2px 2px 10px #ccc;
    left: 50%;
    margin: -130px 0 0 -250px;
    position: absolute;
    top: 35%;
    width: 460px;

    .control-group {
      padding: 0 20px;
    }

    .alert {
      margin: 0 20px 20px;
    }

    .form-actions {
      padding-left: 20px;
    }

    form {
      margin-bottom: 0;
      padding-top: 15px;

      .form-actions {
        margin-bottom: 0;
      }
    }

    div input.big {
      font-size: 25px;
      height: 35px;
    }
  }

  .sonata-ba-field-inline-table {
    input.title {
      width: 100px;
    }

    textarea.title {
      height: 50px;
      width: 150px;
    }
  }

  .sonata-actions {
    float: right;
  }

  &.sonata-ba-modal-edit-one-to-one {
    td.sonata-ba-list-field-batch,
    div.sonata-ba-list-actions,
    th.sonata-ba-list-field-header-batch {
      display: none;
    }

    div.sonata-ba-list-actions {
      display: none;
    }
  }
}

th {
  &.sonata-ba-list-field-header-order-asc,
  &.sonata-ba-list-field-header-order-desc {
    &.sonata-ba-list-field-order-active a::after {
      color: black;
      display: block;
      font-size: 20px;
      line-height: 20px;
      margin-top: -12px;
      position: absolute;
      right: -18px;
      top: 50%;
    }

    a {
      display: inline-block;
      margin-right: 10px;
      position: relative;
    }
  }

  &.sonata-ba-list-field-order-active {
    &.sonata-ba-list-field-header-order-asc a::after {
      content: '↓';
    }

    &.sonata-ba-list-field-header-order-desc a::after {
      content: '↑';
    }

    &.sonata-ba-list-field-header-order-asc a:hover::after {
      content: '↑';
    }

    &.sonata-ba-list-field-header-order-desc a:hover::after {
      content: '↓';
    }
  }
}

.sonata-search-result-list {
  > li {
    word-wrap: break-word;
  }
}

.search-box-item {
  .matches {
    overflow-x: auto;
    white-space: nowrap;

    > a.label {
      margin: 0 1px;
    }
  }
}

td {
  &.pager ul {
    float: left;
    list-style: none;
    margin: 2px;
    margin-left: auto;
    margin-right: auto;

    li {
      float: left;

      a {
        border: 1px solid #ccc;
        line-height: 25px;
        margin: 2px;
        padding: 1px 8px;
      }
    }
  }

  &.sonata-ba-list-field.sonata-ba-list-field-boolean {
    i {
      margin-right: 1ex;
    }

    a:hover {
      text-decoration: none;
    }
  }

  &.sonata-ba-list-field.sonata-ba-list-field-currency,
  &.sonata-ba-list-field.sonata-ba-list-field-percent,
  &.sonata-ba-list-field.sonata-ba-list-field-integer {
    text-align: right;
  }

  &.sonata-ba-list-field.sonata-ba-list-field-select {
    text-align: center;
  }
}

.sonata-bc.sonata-ba-no-side-menu div.container-fluid > div.content {
  margin-left: 0;
}

h4.filter_legend table {
  margin: 10px 0;
}

table.sonata-ba-list td img {
  vertical-align: bottom;
}

.sonata-ba-action.btn:not(:hover) {
  background: none;
  color: inherit;
}

.sonata-ba-list td.sonata-ba-list-field a.sonata-link-identifier {
  font-weight: bold;
}

.sonata-ba-list-field-header-label-icon {
  margin-right: 2px;
}

em.sonata-ba-field-help {
  color: #999;
  display: block;
  margin-bottom: 10px;
}

fieldset legend {
  padding-left: 0;
}

textarea.sonata-medium {
  height: 125px;
}

select.sonata-medium,
textarea.sonata-medium,
input.sonata-medium {
  width: 400px;

  .sonata-ba-field-inline-table & {
    width: 150px;
  }
}

input[type='file'] {
  height: 34px;
}

.sonata-ba-field-standard-natural .field-actions {
  display: block;
  margin-top: 5px;
}

.sonata-ba-view-title {
  color: #404040;
  font-size: 19px;
  line-height: 1;
  padding: 0 0 5px;

  td,
  th {
    border: 0;
  }
}

.sonata-ba-view-container {
  th {
    width: 130px;
  }

  td,
  th {
    border-bottom: 0;
    border-top: 1px solid #eee;
  }

  &.history-audit-compare {
    th {
      width: 10%;
    }

    th.diff {
      background: pink;
    }

    td {
      width: 40%;
    }
  }

  &:nth-child(2n) {
    td,
    th {
      background-color: #f9f9f9;
    }
  }
}

.table-striped tbody tr.sonata-ba-list-row-selected td,
.table-striped tbody tr.sonata-ba-list-row-selected th {
  background-color: #e3f7fe;
}

.sonata-ba-view-container:nth-child(2n):hover {
  td,
  th {
    background-color: #f5f5f5;
  }
}

.container-fluid > .sidebar {
  top: auto;
}

.sonata-action-element.btn-group {
  display: inline-block;
  padding: 4px 10px;
  vertical-align: middle;
}

.sonata-collection-add,
.sonata-collection-delete {
  box-shadow: none;
}

.no-js .sonata-collection-add,
.no-js .sonata-collection-delete {
  display: none;
}

ul.inputs-list {
  padding-left: 150px;
}

legend + .sonata-ba-collapsed-fields {
  margin-top: 18px;
  -webkit-margin-top-collapse: separate;
}

legend.sonata-ba-fieldset-collapsed-description + .sonata-ba-collapsed-fields {
  margin-top: 0;
}

.sonata-ba-collapsed-fields > p {
  margin-bottom: 18px;
}

.bordered-table tbody.ui-sortable tr {
  cursor: move;
}

.sonata-ba-fieldset-collapsed legend::before {
  content: '+ ';
}

.sonata-ba-collapsed-fields-close legend::before {
  content: '- ';
  padding-left: 5px;
}

.sonata-preview-form-container fieldset,
.sonata-preview-form-container .tabbable {
  display: none;
}

.pagination {
  margin: 0;
}

.field-short-description {
  background: #fefefe;
  border: 1px solid #e9e9e9;
  border-radius: 4px;
  display: block;
  float: left;
  list-style: none outside none;
  margin: 0 15px 0 0;
  min-height: 18px;
  min-width: 250px;
  padding: 4px 15px;
}

.required::after {
  content: '*';
}

.noscript-warning {
  background-color: #c70a0a;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  padding: 4px 0;
  text-align: center;
  width: 100%;
}

.navbar.stuck {
  border-radius: 0;
  margin-left: -15px;
  position: fixed;
  top: 50px;
  transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
  width: calc(100% - 230px);
  z-index: 5;
}

.form-actions.stuck {
  border-radius: 0;
  bottom: 0;
  margin-bottom: 0;
  margin-left: -15px;
  position: fixed;
  transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
  width: calc(100% - 230px);
  z-index: 5;
}

.sidebar-collapse {
  .navbar.stuck,
  .form-actions.stuck {
    width: 100%;
  }
}

@media (width <= 768px) {
  body.fixed {
    .main-header {
      position: relative;
    }

    .content-wrapper,
    .right-side {
      padding-top: 50px;
    }

    .navbar.stuck {
      margin: 0;
      position: relative;
      top: 0;
      width: 100%;
    }

    .form-actions.stuck {
      width: 100%;
    }

    .main-sidebar {
      position: absolute;

      /* disable slimScroll */
      .slimScrollDiv,
      .main-sidebar .sidebar {
        height: auto !important;
        overflow: visible !important;
      }
    }
  }

  .navbar-custom-menu > .navbar-nav > li > .dropdown-menu {
    min-width: 230px; /* width of the left sidebar */
    width: auto !important;
  }
}
